/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PanelHistoriaClinica.java
 *
 * Created on 19/03/2012, 09:43:21 AM
 */
package com.torresquintero.oncologos.medico.vista;

import com.torresquintero.oncologos.common.vista.PanelOncologos;
import com.torresquintero.oncologos.entidades.Consulta;
import com.torresquintero.oncologos.entidades.DetalleHistoriaClinica;
import com.torresquintero.oncologos.entidades.HistoriaClinica;
import com.torresquintero.oncologos.medico.controlador.AtenderConsultaController;

/**
 *
 * @author Camilo Andres
 */
public class PanelHistoriaClinica extends PanelOncologos {

    private HistoriaClinica historia;
    private AtenderConsultaController consulta;

    public PanelHistoriaClinica(HistoriaClinica historia, AtenderConsultaController consulta) {
        this.historia = historia;
        this.consulta = consulta;

        initComponents();
        panelVerHistoriaClinicaPac1.setHistoria(historia);
        DetalleHistoriaClinica detalle = consulta.getDetalleHistoria();
        if (detalle != null) {
            tpComentario.setText(detalle.getComentario());
        }
    }

    /** Creates new form PanelHistoriaClinica */
    public PanelHistoriaClinica() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane2 = new javax.swing.JScrollPane();
        tpComentario = new javax.swing.JEditorPane();
        jLabel1 = new javax.swing.JLabel();
        bGuardar = new javax.swing.JButton();
        panelVerHistoriaClinicaPac1 = new com.torresquintero.oncologos.common.vista.PanelVerHistoriaClinicaPac();

        tpComentario.setContentType("text/html");
        jScrollPane2.setViewportView(tpComentario);

        jLabel1.setFont(new java.awt.Font("Tahoma", 3, 14)); // NOI18N
        jLabel1.setText("Comentario");

        bGuardar.setText("Guardar");
        bGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bGuardarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(panelVerHistoriaClinicaPac1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(bGuardar)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 671, Short.MAX_VALUE))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelVerHistoriaClinicaPac1, javax.swing.GroupLayout.PREFERRED_SIZE, 252, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(bGuardar)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void bGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bGuardarActionPerformed
        // TODO add your handling code here:
        consulta.ponerComentarioHistoriaClinica(tpComentario.getText());
    }//GEN-LAST:event_bGuardarActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bGuardar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane2;
    private com.torresquintero.oncologos.common.vista.PanelVerHistoriaClinicaPac panelVerHistoriaClinicaPac1;
    private javax.swing.JEditorPane tpComentario;
    // End of variables declaration//GEN-END:variables
}
